package day05;
import java.util.Arrays;
public class ArrayDemo {
    public static void main(String[] args) {
        //数组的排序
        int[] arr=new int[10];
        for (int i = 0; i < arr.length; i++) {
            arr[i] =(int)(Math.random()*100+1);
            System.out.println(arr[i]);
        }

        Arrays.sort(arr);//对arr数组进行排序
        System.out.println("排序后");
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }


        System.out.println("倒序后");
        for (int i =arr.length-1; i >=0; i--) {
            System.out.println(arr[i]);
        }

        System.out.println("第一个元素为："+arr[0]);















      /*  int[] a=new int[100];
        int[] b={3,5,8,9,};
        int[] c=new int[]{3,6,9,4,};
        int[] d;
        d=new int[]{3,6,9,7};
        double[] e = new double[10];
        String[] s=new String[3];
        a[1]=100;
        System.out.println(a[1]);

        int[] arr =new int[3];
        System.out.println("数组的长度为"+arr.length);
        System.out.println(arr[1]);//数组中第二个元素
        arr[0]=100;
        arr[1]=200;
        arr[2]=300;
        System.out.println(arr[1]);
        System.out.println(arr[arr.length-1]);

       */
      /*  int[] arr=new int[10];
        for (int i = 0; i < arr.length; i++) {
            arr[i]=(int)(Math.random()*100+1);
            System.out.println(arr[i]);
        }

       */

    }
}
